ScxV6Object.Convert Method
Converts the object into another type of object.
Parameters
- NewClassName
The name of the database class that the database object will be converted to.
Remarks
Use the Convert method to convert a database object from one type to another.
The conversion operation may fail if:
- The user does not have configuration privilege for the object
- The Class parameter is not a creatable object, see Database Structure, Schema, Object Names and Identifiers for more information.
- The existing object class and new object class must be compatible for the conversion to succeed. For example digital points can be converted from one type to another, but a digital point cannot be converted into an analogue point.
The following example written in VB.NET uses the Convert method to convert an internal analogue point into a modbus analogue:
Dim Svr As ScxV6DbClient.ScxV6Server
' Connect to the server
Dim Svr As ScxV6DbClient.ScxV6Server
' Connect to the server
Svr = New ScxV6DbClient.ScxV6Server
Svr.Connect("MAIN", "", "")
Dim Obj As ScxV6DbClient.ScxV6Object
Obj = Svr.FindObject("Group.Test Point")
' Set the format on the internal analogue. This will be preserved when converted
Obj.Interface.Format = "0.00"
Console.WriteLine("Class before conversion: {0}", Obj.Class.Name)
Try
Obj.Convert("CModbusPointAlg")
Catch ex As Exception
' Output any warnings/errors
Console.WriteLine("Warnings detected:")
Console.WriteLine(ex.Message)
Console.WriteLine("")
End Try
Console.WriteLine("Class after conversion: {0}", Obj.Class.Name)
Console.WriteLine("Format after conversion: {0}", Obj.Interface.Format)
' Disconnect
Svr.Disconnect()
This produces the following output:
Class before conversion: CPointAlgManual
Warnings detected:
Point requires a scanner.
Class after conversion: CModbusPointAlg
Format after conversion: 0.00